package com.sys.dao;

import java.sql.SQLException;
import java.util.List;

import com.sys.domain.User;

/**
 * @ClassName: UserDao 
 * @Description: TODO(提供与用户信息有关的操作数据库的服务) 
 * @author 詹金浩
 * @date 2018年3月8日 下午12:24:18
 */
public interface UserDao {
	/**
	 * @Title: add 
	 * @Description: TODO(向学生信息数据库插入一条用户信息) 
	 * @param user user各属性的值都不为空
	 * @return Boolean。插入成功返回真，否则返回假。
	 * @throws SQLException
	 */
	Boolean add(User user) throws SQLException;
	
	/**
	 * @Title: isUserIdLegal 
	 * @Description: TODO(查询合法用户id的数据库，判断此学号是否可注册) 
	 * @param userId
	 * @return Boolean 合法返回真，不合法返回假。
	 * @throws SQLException
	 */
	Boolean isUserIdLegal(String userId) throws SQLException;
	
	/**
	 * @Title: delete 
	 * @Description: TODO(删除数据库中一条用户信息) 
	 * @param user
	 * @throws SQLException
	 * @return Boolean
	 */
	Boolean delete(User user) throws SQLException;
	
	/**
	 * @Title: findUserByUserId 
	 * @Description: TODO(查找此id是否存在于用户信息表中) 
	 * @param userId
	 * @return User
	 * @throws SQLException
	 */
	User findUserByUserId(String userId) throws SQLException;
	
	/**
	 * @Title: changeUserPwdByUserId 
	 * @Description: TODO(修改user_pwd字段的值) 
	 * @param userId
	 * @return Boolean
	 * @throws SQLException
	 */
	Boolean changeUserPwdByUserId(String userId, String newPwd) throws SQLException;
	
	/**
	 * @Title: isEmailExist 
	 * @Description: TODO(检测邮箱是否已被注册) 
	 * @param eMail
	 * @return Boolean 已被注册返回真，未被注册返回假
	 * @throws SQLException 
	 */
	Boolean isEmailExist(String eMail) throws SQLException;
	
	/**
	 * @Title: findUserByIdAndPwd 
	 * @Description: TODO(通过学号和密码查找用户) 
	 * @param userId userName
	 * @return Boolean 查找到返回真，查找不到返回假
	 * @throws SQLException
	 */
	Boolean findUserByIdAndPwd(String userId, String userPwd) throws SQLException;
	
	/**
	 * @Title: findUserByIdAndEmail 
	 * @Description: TODO(通过邮箱和密码查找用户) 
	 * @param userPwd eMail
	 * @return Boolean 查找到返回真，查找不到返回假
	 * @throws SQLException
	 */
	Boolean findUserByEmailAndPwd(String eMail, String userPwd) throws SQLException;
	
	/**
	 * @Title: getUserIdByEmail 
	 * @Description: TODO(通过eMail查找记录并且返回对应的id值) 
	 * @param eMail
	 * @return String
	 * @throws SQLException
	 */
	String getUserIdByEmailDao(String eMail) throws SQLException;
	
	/**
	 * @Title: checkUserInfoWhoChangePwd 
	 * @Description: TODO(根据userId, eMail, userPwd查找用户是否存在) 
	 * @param userId eMail userPwd
	 * @return Boolean 存在返回真，不存在返回假
	 * @throws SQLException
	 */
	Boolean checkUserInfoWhoChangePwd(String userId, String eMail, String userPwd) throws SQLException;
	
	/**
	 * @Title: allUsers 
	 * @Description: TODO(所有的用户) 
	 * @return List<User>
	 * @throws SQLException
	 */
	List<User> allUsers() throws SQLException;
	
	/**
	 * @Title: changeStatus 
	 * @Description: TODO(改变用户的状态) 
	 * @param userId status
	 * @return Boolean
	 * @throws SQLException
	 */
	Boolean changeStatus(String userId, String status) throws SQLException;
	
	/**
	 * @Title: getStatus 
	 * @Description: TODO(获得用户的状态) 
	 * @param userId
	 * @return String
	 * @throws SQLException
	 */
	String getStatus(String userId) throws SQLException;
}
